home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / tcp / rxsocket.lha / rxsocket / examples / suitable.rexx < prev    next >
OS/2 REXX Batch file  |  2000-11-28  |  750b  |  35 lines

  1. /*
  2.     SEARCH FOR A "SUITABLE INTERFACE" = "UP AND NOT LOOPBACK"
  3. */
  4.  
  5. l="rexxsupport.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
  6. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
  7. l="rxsocket.library";if ~show("L",l) then;if ~addlib(l,0,-30) then do;say "can't find" l;exit;end
  8.  
  9. prg=ProgramName("NOEXT")
  10.  
  11. if arg()~=0 then do
  12.     call PrintFault(118,prg)
  13.     exit
  14. end
  15.  
  16. res=QueryInterfaces("IN")
  17. if res<0 then do
  18.     say prg": cannot query ("errno()")"
  19.     exit
  20. end
  21. if res==0 then do
  22.     say prg": no suitable device found"
  23.     exit
  24. end
  25.  
  26. do i=0 to res-1
  27.     if in.i.family==2 & in.i.UP==1 & in.i.LOOPBACK==0 then do
  28.         say prg":" in.i.NAME
  29.         exit
  30.     end
  31. end
  32.  
  33. say prg": no suitable device found"
  34.  
  35.